package com.util;

public class DaysCount {
	public static int daysIn(int month, int year){
		switch(month){
			case 0:
				return 31;
			case 1:
				if(isLeap(year))
					return 29;
				else
					return 28;
			case 2:
				return 31;
			case 3:
				return 30;
			case 4:
				return 31;
			case 5:
				return 30;
			case 6:
				return 31;
			case 7:
				return 31;
			case 8:
				return 30;
			case 9:
				return 31;
			case 10:
				return 30;
			case 11:
				return 31;
		}
		return 31;
	}
	
	public static boolean isLeap(int year){
		return (year % 4 == 0 && year % 400 != 0);
	}
	
	public int getMonthNum(String month){
		String[] months = new java.text.DateFormatSymbols().getMonths();
		for(int i = 0; i < 12; i++)
			if(month.equalsIgnoreCase(months[i]))
				return i;
		return -1;
			
	}
}
